package web.common.internal.jdo.mapper;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;

/**
 * @author Jin Zheng
 * @since 2021-12-13
 */
public class SqlTimeRowMapper implements RowMapper<Time> {
	public SqlTimeRowMapper() {
	}

	@Override
	public Time mapRow(ResultSet rs, int row) throws SQLException {
		var meta = rs.getMetaData();
		if (meta.getColumnCount() < RowMapperFactory.ONE) {
			return null;
		}
		return rs.getTime(RowMapperFactory.ONE);
	}
}
